#!/bin/sh
# use pSchedule to schedule cron tasks...

kill_crond() {
	busybox ps | grep -v "grep" | grep " crond" | awk '{print $1}' | \
		while read pid ; do 
			kill -9 $pid 2>/dev/null
		done
}

case $1 in
	start)
		if ! ( busybox ps | grep -v "grep" | grep -q " crond" ) ; then
			mkdir -p /var/spool/cron/crontabs
			busybox crond -c /var/spool/cron/crontabs
		fi
		;;
	restart)
		kill_crond
		mkdir -p /var/spool/cron/crontabs
		busybox crond -c /var/spool/cron/crontabs
		;;
	stop)
		kill_crond
		;;
esac

### END ###
